package com.lottery.ruok.lottrey.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import com.lottery.ruok.lottrey.adapter.fragmentManager.PrizeListPagerFragmentManager;

/**
 * Created by ASUS on 2017/10/11.
 */

public class PrizePagerAdapter extends FragmentStatePagerAdapter {

    public PrizePagerAdapter(FragmentManager fragmentManager) {
        super(fragmentManager);

    }

    @Override
    public Fragment getItem(int position) {
        return PrizeListPagerFragmentManager.getFragment(position);
    }

    @Override
    public int getCount() {
        return PrizeListPagerFragmentManager.getSize();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return PrizeListPagerFragmentManager.getTitle(position);
    }

    @Override
    public void finishUpdate(ViewGroup container) {
        try{
            super.finishUpdate(container);
        } catch (NullPointerException nullPointerException){
            //抓到这个异常，https://stackoverflow.com/questions/41650721/attempt-to-invoke-virtual-method-android-os-handler-android-support-v4-app-frag
        }
    }
}
